$$(document).ready ->
  pane = null
  clearTimer = null

  $$(document).on 'touchstart', '#showside', (e) ->
    e.preventDefault()
    if pane == null then showSide() else hideSide()

  # 显示弹出栏
  showSide = ->
    side = document.getElementById('side')
    document.body.style.overflow = 'hidden'
    insertPane()
    pane.innerHTML = side.innerHTML

  # 隐藏弹出栏
  hideSide = ->
    document.body.style.overflow = 'auto'
    pane.className += ' hide'
    clearTimer = setTimeout removePane, 810

  # 插入面板
  insertPane = ->
    removePane() if clearTimer
    pane = document.createElement('div')
    pane.id = 'sideFixedPane'
    pane.className = 'cl pane fixed'
    setTimeout ->
      document.body.appendChild(pane)
    , 0

  # 移除面板
  removePane = ->
    clearTimeout(clearTimer)
    pane.parentNode.removeChild(pane)
    pane = null
    clearTimer = null